package com.inspur.dgov.vlbod.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.inspur.dgov.vlbod.entity.LiveBroadcast;
import com.baomidou.mybatisplus.extension.service.IService;
import com.inspur.dgov.vlbod.entity.LiveVideoPullurls;
import com.inspur.dgov.vlbod.secure.token.UserRecord;
import com.inspur.dgov.vlbod.vo.LiveBroadcastVO;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  直播信息服务类
 * </p>
 *
 * @author chiyupei
 * @since 2023-05-28
 */
public interface LiveBroadcastService extends IService<LiveBroadcast> {

    /**
     * 获取我的直播列表
     * @param page
     * @param data
     * @return
     */
    Page<LiveBroadcastVO> queryMyList(Page<LiveBroadcastVO> page, JSONObject data);

    /**
     * 获取我的收藏列表
     * @param page
     * @param data
     * @return
     */
    Page<LiveBroadcastVO> queryCollectList(Page<LiveBroadcastVO> page, JSONObject data);

    /**
     * 获取直播列表
     * @param page
     * @param data
     * @return
     */
    Page<LiveBroadcastVO> queryList(Page<LiveBroadcastVO> page, JSONObject data);

    /**
     * 直播信息新增保存
     * @param data
     * @return
     */
    LiveBroadcast saveLiveBroadcast(LiveBroadcast data) throws RuntimeException;

    /**
     * 直播信息修改保存
     * @param data
     * @return
     * @throws RuntimeException
     */
    LiveBroadcast updateLiveBroadcast(LiveBroadcast data) throws RuntimeException;

    /**
     * 删除直播信息
     * @param data
     * @throws RuntimeException
     */
    void deleteLiveBroadcast(LiveBroadcast data) throws RuntimeException;

    LiveBroadcast selectLiveBroadcastById(String id);

    /**
     * 获取直播状态
     * @param id 直播id
     * @return 状态
     */
    String getLiveBroadcastStatus(String id);

    /**
     * 获取视频拉流地址
     * @param id 直播id
     * @return url列表
     */
    List<LiveVideoPullurls> getLiveBroadcastVideoPullList(String id);

    /**
     * 开始直播
     * @return 小鱼视频需要调用app param
     */
    Map<String,Object> startLiveBroadcast(String lvbId, long deplaySecond, UserRecord userRecord);
}
